#import <Foundation/Foundation.h>
#import "GameTypes.h"

@protocol GameEngineDelegate <NSObject>

- (void)gameStateDidChange;
- (void)gridDidUpdateAtPosition:(Position *)position;
- (void)playerStatsDidChange;
- (void)showMessage:(NSString *)message;

@end

@interface GameEngine : NSObject

@property (nonatomic, weak) id<GameEngineDelegate> delegate;
@property (nonatomic, assign, readonly) GameState gameState;
@property (nonatomic, assign, readonly) NSInteger playerHealth;
@property (nonatomic, assign, readonly) NSInteger playerWeapon;
@property (nonatomic, assign, readonly) NSInteger enemiesKilled;
@property (nonatomic, assign, readonly) NSInteger bossHealth;
@property (nonatomic, strong, readonly) Position *playerPosition;
@property (nonatomic, strong, readonly) NSArray<NSArray<GridItem *> *> *grid;

- (instancetype)init;
- (void)movePlayerToPosition:(Position *)position;
- (void)restartGame;
- (BOOL)isValidMove:(Position *)position;
- (GridItem *)gridItemAtPosition:(Position *)position;
@end
